set /p needMergeBranch=Please enter the name of the 'source' remote branch:

echo The 'source' remote branch name entered:%needMergeBranch%


set /p checkoutRemoteBranch=Please enter the 'target' remote branch name:

echo The 'target' remote branch name entered:%checkoutRemoteBranch%



set work_path=%~dp0
cd /d %work_path%
cd ../
set work_path=%cd%



echo ====Unsubmitted requests need to be processed before detection!!! Otherwise, it cannot be detected!!!====

echo soon merge %needMergeBranch% to %checkoutRemoteBranch%
echo soon merge %needMergeBranch% to %checkoutRemoteBranch%
echo soon merge %needMergeBranch% to %checkoutRemoteBranch%
echo soon merge %needMergeBranch% to %checkoutRemoteBranch%
echo soon merge %needMergeBranch% to %checkoutRemoteBranch%
echo soon merge %needMergeBranch% to %checkoutRemoteBranch%

pause


for /d %%s in (%work_path%\*) do (
cd %%s
echo Check out branches %% %%s %% %checkoutRemoteBranch%
git checkout %checkoutRemoteBranch%

)

for /d %%s in (%work_path%\*) do (
cd %%s
echo Update Code %% %%s %% %checkoutRemoteBranch%
start "%%s" cmd /c "git pull origin %checkoutRemoteBranch% --no-edit"
)

TIMEOUT /T 60

for /d %%s in (%work_path%\*) do (
cd %%s
echo Pull Merge%needMergeBranch%branch %% %%s %% %checkoutRemoteBranch%
start "%%s" cmd /c "git pull origin %needMergeBranch%  --no-edit"
)


echo ok...
pause

